package com.zxp.jpa.model;

import cn.hutool.core.lang.generator.SnowflakeGenerator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.zxp.common.db.model.Domain;
import com.zxp.jpa.idgen.ZxpSnowflakeGenerator;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * @author zxp
 * @date 2021/8/10 11:26
 */
@Data
@MappedSuperclass
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"},ignoreUnknown = true)
public class LongEntity implements Domain<Long> {

    @Id
    @GenericGenerator(name="snowflake",strategy = ZxpSnowflakeGenerator.TYPE)
    @GeneratedValue(generator = "snowflake")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

}
